Skip to content

feat: make prompt and librarian client timeouts configurable (#874) - #1108

Open
sunnyadn wants to merge 1 commit into
trustgraph-ai:release/v2.9from
sunnyadn:feat/874-client-timeouts
Open

feat: make prompt and librarian client timeouts configurable (#874)#1108
sunnyadn wants to merge 1 commit into
trustgraph-ai:release/v2.9from
sunnyadn:feat/874-client-timeouts

Conversation

@sunnyadn

@sunnyadn sunnyadn commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Second slice of #874, after #1063. Against release/v2.9, happy to retarget.

Changes

  • Specs that create a client (RequestResponseSpec, LibrarianSpec) now take a timeout. If none is given they read it off the processor (prompt_timeout, librarian_timeout, config_timeout) and fall back to the old literal. The impl wrapper and the client methods pass None through instead of pinning a number, so per-call timeouts still override.
  • --prompt-timeout (600) on FlowProcessor. --librarian-timeout (120) via WorkspaceProcessor.add_librarian_args, used by FlowProcessor and the cores service, so the librarian and flow services don't advertise a flag they don't use.
  • No processor changed. The cost is that every flow processor now lists both flags in --help, whether or not it has that client. If you'd rather have timeout=self.prompt_timeout at each of the ~20 call sites instead, I'm happy to do that here.

Behaviour

1 default moves. A bare flow("prompt-request").request(req) used to get the generic wrapper's 300 and now gets 600, the default every other prompt call already had. 4 callers in tree: nlp_query/service.py:170,235 and structured_diag/service.py:382,487. Keeping 300 there would have left them outside the knob, so I think 600 is the right side of this, but it is a change.

ConfigClientSpec (exported, unused in tree) now follows --config-timeout, effective default still 60. document_rag keeps --fetch-chunk-timeout for the chunk fetch, only its help text changed.

Tests

24 new tests, 20 fail with the source reverted to release/v2.9. Unit, contract and integration pass in CI. Also ran it against a Pulsar standalone: --prompt-timeout 2 and --librarian-timeout 2 cut a 5 s stub at 2 s, and the defaults behave as before.

Second slice of trustgraph-ai#874. A spec that creates a client resolves its timeout
as: explicit constructor value, else the processor attribute the spec
names, else the class default (TimeoutSpec mixin). RequestResponseSpec
and LibrarianSpec thread the result into the client they create.
PromptClient and AsyncLibrarianClient methods default to None and fall
back to it, per-call timeouts still override. --prompt-timeout (600)
on FlowProcessor. --librarian-timeout (120) via
WorkspaceProcessor.add_librarian_args, called by FlowProcessor and the
cores service, which also passes it to its direct AsyncLibrarianClient.

1 default moves: a bare prompt-request wrapper call with no timeout
goes from the generic wrapper's 300 to the prompt default 600 (4
in-tree sites in nlp_query and structured_diag). ConfigClientSpec now
follows --config-timeout with the same 60 it resolved to before.
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Contributor License Agreement ✅

All contributors have signed the CLA. Thank you!

@sunnyadn
sunnyadn marked this pull request as ready for review September 2, 2026 21:47
@cybermaggedon cybermaggedon self-assigned this Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants